addMenuProvider

abstract fun addMenuProvider(@NonNull provider: MenuProvider)(source)

Adds the given MenuProvider to this MenuHost. If using this method, you must manually remove the provider when necessary.

Parameters

provider

the MenuProvider to be added

See also


abstract fun addMenuProvider(@NonNull provider: MenuProvider, @NonNull owner: LifecycleOwner)(source)

Adds the given MenuProvider to this MenuHost. This MenuProvider will be removed once the given LifecycleOwner receives an Lifecycle.Event.ON_DESTROY event.

Parameters

provider

the MenuProvider to be added

owner

the Lifecycle owner whose state will determine the removal of the provider


Adds the given MenuProvider to this MenuHost once the given LifecycleOwner reaches the given Lifecycle.State. This MenuProvider will be removed once the given LifecycleOwner goes down from the given Lifecycle.State.

Parameters

provider

the MenuProvider to be added

state

the Lifecycle.State to check for automated addition/removal

owner

the Lifecycle owner whose state will be used for automated addition/removal